All Questions
Tagged with entity-framework-coreautomapper
300 questions
0votes
1answer
94views
Conditional map "null" of non-nullable types, enums, and collections with AutoMapper in C#
I'm developing a PATCH REST endpoint to do partial update to an EF Core entity. All properties in the request DTO (EntityRequestDto) are marked as nullable, while the actual entity (Entity) will be ...
-1votes
1answer
70views
MapFrom and ProjectTo fail to populate target property
Given the following EF Core entity class: [PrimaryKey(nameof(CustomerID))] [Table(nameof(Customer))] public partial class Customer { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] ...
0votes
2answers
248views
EF Core throws a tracking exception when updating entities using AutoMapper
I'm using EF Core against a SQL Server database in a Blazor web app (on .NET 9) with Identity, and I am using AutoMapper to convert between the database entities and the DTOs that get sent out of and ...
0votes
1answer
130views
hot chocolate and automapper could not be translated when model contains collection
I have a resolver that returns an IQueryable from Entity Framework Core. When I return the EF Core entity directly, everything works fine. However, when I attempt to map the EF Core entity to my ...
-1votes
1answer
104views
AutoMapper DTO Not Serializing Correctly for Derived Class Insertion
I'm facing an issue with inserting a derived type of alert in my application. I have a base class, Alert, and its corresponding DTO, along with a derived class, OperationalAlert, which extends Alert, ...
-1votes
2answers
396views
How to map and save a model to an entity using Automapper in Entity Framework Core [duplicate]
I have this EmployeeEntity class which is part of my database context. public class EmployeeEntity { public int Id { get; set; } public string FirstName { get; set; } //more properties }...
1vote
2answers
67views
Using Automapper to Map M:M Relationships in EF Core
I have the following two classes: public class ADto { public int Id { get; set; } public List<BDto>? BSet { get; set; } } public class A { public int Id { get; set; } public ...
0votes
1answer
135views
AutoMapper Problems with one profile for Map and ProjectTo
AutoMapper Version=13.0.1 Microsoft.EntityFrameworkCore Version=7.0.20 Microsoft.EntityFrameworkCore.InMemory Version=7.0.20 Expected behavior I would like to create one profile and combine the work ...
0votes
0answers
61views
AutoMapper - EF Core: reuse entity in navigation property
I got to refactor some existing code and there I hit a scenario I need to resolve using AutoMapper and EF Core. There are business and entity objects, for example: class BusinessMaster { public ...
1vote
1answer
98views
How do I setup entity relationships when there are user roles involved?
I am creating a project management application for my portfolio similar to Jira where Users can collaborate on projects, create tickets, leave comments on tickets, etc.. I'm setting up the entity ...
1vote
1answer
72views
Automapper ConstructUsing through a relationship
I have a mapping setup to go from my Entity Framework Software model to SoftwareDTO, which is working correctly when I project to it like this: var stuff = await ChecklistLink.AsNoTracking() ....
-1votes
1answer
69views
how to send extra data to Automapper
We have an entity type class that when it is converted to its dto class, I want a property to be set with additional calculations. Entity class: public class Student { public int Id { get; set; } ...
0votes
0answers
185views
OData filter flags enum 'has' operator translated to .HasFlag(value) but not in a form EF Core accepts
The AutoMapper.Extensions.OData github repo instructs to go here first, so I hope this finds the right people. I'm not exactly sure if this is related to AutoMapper.AspNetCore.OData.EFCore, AutoMapper....
2votes
1answer
129views
How to map two nested list with Automapper
Entities public class PurchaseReq { ... public string PrNumber { get; set; } // primary key public List<PurchaseReqItem> PurchaseReqItems { get; init; } = []; public List<...
2votes
1answer
243views
Automapper use ProjectTo after GroupBy
Here are the Entity and the ViewModel: public class Journal { public int Id { get; set; } public DateTime Date { get; set; } public int ProductId { get; set; } public string SKU { get; ...